//
//  HomeTodayCollectionViewCell.m
//  Cat
//
//  Created by lushitong on 2018/12/22.
//  Copyright © 2018年 lushitong. All rights reserved.
//

#import "HomeTodayCollectionViewCell.h"
#import "HomeTodayCollectView.h"

@interface HomeTodayCollectionViewCell()

@property (nonatomic, strong) HomeTodayCollectView *toddayView;
@property (nonatomic, strong) UIView *bottomView;

@end

@implementation HomeTodayCollectionViewCell

- (void)setHotsArray:(NSArray *)hotsArray {
	_hotsArray = hotsArray;
	[self.toddayView setHotsArray:hotsArray];
}

- (instancetype)initWithFrame:(CGRect)frame {
	if (self = [super initWithFrame:frame]) {
		self.backgroundColor = [UIColor whiteColor];
		[self loadSubviews];
	}
	return self;
}

- (void)loadSubviews {
	[self.contentView addSubview:self.toddayView];
	[self.contentView addSubview:self.bottomView];
	
	[self.toddayView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.left.and.right.equalTo(self.contentView);
		make.top.equalTo(self.contentView.mas_top).offset(kQKFitModuleDecimal(13.0));
		make.bottom.equalTo(self.contentView).offset(kQKFitModuleDecimal(-8));
	}];
	
	[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.left.and.right.and.bottom.equalTo(self.contentView);
		make.height.equalTo(@(kQKFitModuleDecimal(8.0)));
	}];
}

#pragma mark----- lazy init -----

- (HomeTodayCollectView *)toddayView {
	if (!_toddayView) {
		UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
		flowLayout.itemSize = CGSizeMake(kQKFitModuleDecimal(104), kQKFitModuleDecimal(104 + 104));
		flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
		flowLayout.sectionInset = UIEdgeInsetsMake(10, 15, 10, 15);
		flowLayout.minimumLineSpacing = kQKFitModuleDecimal(8);
		_toddayView.backgroundColor = [UIColor whiteColor];
		_toddayView = [[HomeTodayCollectView alloc] initWithFrame:CGRectMake(0.0, 0.0, ScreenWidth , kQKFitModuleDecimal(13 + 104 + 60)) collectionViewLayout:flowLayout];
	}
	return _toddayView;
}

- (UIView *)bottomView {
	if (!_bottomView) {
		_bottomView = [[UIView alloc] init];
		_bottomView.backgroundColor = COLOR_WITH_HEX(0xF2F2F2);
	}
	return _bottomView;
}

@end
